﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using VIP.Infrastructure.Exceptions;
using WebApplication.Filters;

namespace WebApplication.Controllers
{
    [ApiController]
    [Route("BaseData/[controller]")]
    public class FilterDemoController : ControllerBase
    {
        private readonly ILogger<FilterDemoController> _logger;

        public FilterDemoController(ILogger<FilterDemoController> logger)
        {
            _logger = logger;
        }
        [HttpGet]
        [Route("Error")]
        public bool Error()
        {
            _logger.LogError("测试封装日志");
            int i = 0;
            int result = 10 / i;
            return true;
        }

        [HttpGet]
        [Route("BusError")]
        public bool BusError(int a, int b)
        {
            throw new VIPBusinessException("没有传入学员编号");
            return true;
        }
    }
}
